package org.weishe.demo;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;

public class LockActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lock);


        float mWidth, mHeight;

        DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);

        WindowManager manger = getWindowManager();
        Display display = manger.getDefaultDisplay();
        display.getHeight();
        mWidth = dm.widthPixels;// 获取屏幕分辨率宽度
        mHeight = dm.heightPixels;

        Log.v("org.weishe.weichat", "---------------------------------");
        Log.v("org.weishe.weichat", "mHeight:" + mHeight);
        // Log.v("org.weishe.weichat", "viewHeight:" + this.getMeasuredHeight());
        Log.v("org.weishe.weichat", "ydpi:" + dm.ydpi);
        Log.v("org.weishe.weichat", "density:" + dm.density);
        // Log.v("org.weishe.weichat", " this.getBottom():" + this.getBottom());
        Log.v("org.weishe.weichat", " display.getHeight():" + display.getHeight());
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_lock, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
